package bh

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentStatePagerAdapter

class FY(fm: FragmentManager, var list: List<Fragment>) : FragmentStatePagerAdapter(
    fm,
    BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT
) {
    override fun getCount(): Int {
        return list.size
    }

    override fun getItem(position: Int): Fragment {
        return list[position]
    }


//    override fun getItem(position: Int): Fragment = list[position]
//
//    override fun getCount(): Int = Int.MAX_VALUE
//
//    override fun instantiateItem(container: ViewGroup, position: Int): Any {
//        //处理position。让数组下标落在[0,fragmentList.size)中，防止越界
//        var position = position
//        position %= list.size
//        return super.instantiateItem(container, position)
//    }


}